<script setup>
import { useCommonStore } from "@/stores/useCommonStore";
import { useI18n } from 'vue-i18n'
</script>
<script>
export default {
	onLaunch: function () {
		// console.log('App Launch')
		// #ifdef APP-PLUS
		//设置3秒后主动关闭
		setTimeout(() => {
			plus.navigator.closeSplashscreen();
		}, 2000);
		// #endif

		let { locale } = useI18n()
		let commonStore = useCommonStore();
		// 获取系统信息，包括语言
		const systemInfo = uni.getSystemInfoSync();
		if (systemInfo.language !== 'zh-CN') {// 根据系统语言设置语言
			locale = 'en'
			commonStore.setLang("en")
		} else {
			locale = 'cn'
			commonStore.setLang("cn")
		}
	},
	onShow: function () {
		// console.log('App Show')
		setTimeout(() => {//隐藏底部tabbar
			uni.hideTabBar();
		}, 50)
	},
	onHide: function () {
		// console.log('App Hide')
	}
}
</script>

<style lang="scss">
@import "@/uni_modules/uview-plus/index.scss";

html,
body {
	/* 防止根元素出现滚动条 */
	overflow: hidden;
	height: 100vh;
	margin: 0;
	padding: 0;
}

/*每个页面公共css */
page {
	width: 100%;
	height: 100%;
	/*微信小程序无法使用本地资源图片作为背景图 使用base64格式*/
	background-image: url('');
	background-repeat: no-repeat;
	background-size: cover;
	// background-attachment: fixed;
	background-position: center;
}
</style>
